<!DOCTYPE html>
<html>
<head>
  <%= render_page_title %>
  <meta charset='utf-8' />
  <meta name="keywords" content="<%= @meta_keywords %>" />
  <meta name="description" content="<%= @meta_description %>" />
  <meta name="apple-mobile-web-app-capable" content="no">
  <meta content='True' name='HandheldFriendly' />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link rel="apple-touch-icon-precomposed" href="<%= cached_asset_path("ios-icon.png") %>" />
    <link rel="shortcut icon" href="<%= cached_asset_path("big_logo.png") %>" />
    <link rel="alternate" type="application/rss+xml" title="订阅最新帖" href="<%= feed_topics_url %>" />
    <link rel="mask-icon" href="<%= cached_asset_path("mask.svg") %>" color="#BD2D2D" />
    <%= stylesheet_link_tag_with_cached "front" %>
    <%= javascript_include_tag_with_cached "app" %>
  <%= csrf_meta_tag %>
  <%= yield :node_feed_link %>
  <%= raw SiteConfig.custom_head_html %>
</head>
<body class="page-<%= controller_name %>" data-controller-name="<%= controller_name %>">
  <div class="header">
    <nav class="navbar navbar-inverse navbar-fixed-top navbar-default">
      <div class="container">
        <div class="navbar-header" id="navbar-header" data-turbolinks-permanent>
          <a href="/" class="navbar-brand"><b>TesterHome</b></a>
        </div>

        <span id="main-nav-menu">
          <%= render_list class: "nav navbar-nav" do |li|
            li << link_to(t("menu.topics"), topics_path)
            li << link_to(t("menu.jobs"), jobs_path)
            li << link_to(t("menu.open_course"), opencourses_path)  if !mobile?
            li << link_to(t("menu.wiki"), pages_path) if !mobile?
            # li << link_to(t("menu.timeline"), timeline_path) if !mobile?
            # li << link_to(t("menu.sites"), sites_path) if !mobile?
            li << link_to(t("menu.bugs"), bugs_path) if !mobile?
          end %>
        </span>



          <%= render "common/user_nav" %>

        <ul class="nav navbar-nav navbar-right">
          <li class="nav-search hidden-xs">
            <form class="navbar-form form-search active" action="/search" method="GET">
              <div class="form-group">
                <input class="form-control" name="q" type="text" value="<%= params[:q] %>" placeholder="搜索本站内容" />
              </div>
              <i class="fa btn-search fa-search"></i>
              <!--<i class="fa btn-close fa-times-circle"></i>-->
            </form>
          </li>
          <% if current_user %>
          <%
          badge_class = ""
          badge_class = "new" if unread_notify_count > 0
          %>
          <li class="notification-count">
            <a href="<%= notifications_path %>" class="<%= badge_class %>" title="通知"><i class="fa fa-bell"></i><span class="count"><%= unread_notify_count %></span></a>
          </li>
              <li>
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                  <i class="fa fa-plus"></i> <span class="caret"></span>
                </a>
                <%= render_list class: "dropdown-menu", role: "menu" do |li|
                  li << link_to(t("topics.create_topic"), main_app.new_topic_path)
                  li << link_to(t("notes.create_note"), main_app.new_note_path)
                end %>
              </li>

          <% end %>
        </ul>
      </div>
    </nav>


      <% if mobile? and android? %>
      <div class="alert alert-warning" role="alert">
          <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <a id="android-app" class="btn btn-success btn-lg" href="http://fir.im/p9vs"><i class="fa fa-android"></i> Android 版</a>
      </div>
      <%end%>

  </div>

  <div id="main" class="main-container container">
    <%= birthday_tag %>
    <%= notice_message %>
    <%= yield %>
  </div>

  <% if not mobile? %>
    <a id="go_top" href="#" title='<%= t("common.go_top") %>'><i class="fa fa-angle-up"></i></a>
    <footer class="footer" id="footer" data-turbolinks-permanent>
    <div class="container">
      <%= raw SiteConfig.footer_html %>
    </div>
    </footer>
  <% end %>

  <% if mobile? %>
    <script type="text/javascript">
    app_mobile = true;
    $('body').animate({ scrollTop: -1 },0);
    </script>
  <% end %>
  <script type="text/javascript" data-turbolinks-eval="false">
      App.root_url = "<%= root_url %>";
      App.asset_url = "<%= Setting.upload_url %>";
      App.twemoji_url = "<%= Twemoji.configuration.asset_root %>";
      App.locale = "<%= I18n.locale %>";
      I18n.defaultLocale = "<%= I18n.default_locale %>";
      I18n.locale = "<%= I18n.locale %>";
      I18n.fallbacks = true;
      <% if current_user %>
      App.current_user_id = <%= current_user.id %>;
      App.access_token = "<%= current_user.temp_access_token %>";
      <% end %>
  </script>
  <%= yield :scripts %>

  <script>
    ga('create', '<%= Setting.google_analytics_key %>', 'auto');
    ga('require', 'displayfeatures');
    ga('send', 'pageview');
  </script>
  <div class="zoom-overlay"></div>
</body>
</html>
